package role

import (
	"context"

	"go-zero-mall/app/admin/cmd/api/internal/svc"
	"go-zero-mall/app/admin/cmd/api/internal/types"
	"go-zero-mall/app/admin/cmd/rpc/pd"

	"github.com/jinzhu/copier"
	"github.com/zeromicro/go-zero/core/logx"
)

type RoleUpdateStatusLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRoleUpdateStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RoleUpdateStatusLogic {
	return &RoleUpdateStatusLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RoleUpdateStatusLogic) RoleUpdateStatus(req *types.RoleUpdateStatusReq) (resp *types.RoleUpdateStatusResp, err error) {
	var in pd.UmsRoleUpdateStatusReq
	copier.Copy(&in, req)
	_, err = l.svcCtx.AdminRpc.RoleUpdateStatus(l.ctx, &in)
	return nil, err
}
